package br.edu.ufcg.sig.query.persistencia;

import java.sql.Connection;

import br.edu.ufcg.sig.query.ConnectionUtils;
import br.edu.ufcg.sig.query.QueryTable;
import br.edu.ufcg.sig.query.persistencia.query.QueryDAO;

public class QueryService {
	
	QueryDAO dao;
	
	public QueryService() {
		dao = new QueryDAO();
	}
	
	public QueryTable executeQuery(String query) throws Exception{
		Connection connection = null;

		try {
			connection = ConnectionPollService.getInstance()
					.getConnection();
			
			return dao.executeQuery(connection, query);

		} finally {
			ConnectionUtils.closeConnection(connection);

		}
	}
}
